//
//  ViewController.m
//  ZZProgressHUD
//
//  Created by 陈钟 on 2018/1/4.
//  Copyright © 2018年 陈钟. All rights reserved.
//

#import "ViewController.h"
#import "UIImage+ZZ.h"
#import "ZZProgressHUDShowView.h"
#import "ZZProgressHUD.h"

@interface ViewController (){
    ZZProgressHUDShowView *viewHUD;
    UITextField *textfield;
}

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view setBackgroundColor:[UIColor grayColor]];
    // Do any additional setup after loading the view, typically from a nib.
    UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
    [btn setBackgroundColor:[UIColor redColor]];
    [btn addTarget:self action:@selector(dddd) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    
    
    textfield = [[UITextField alloc] initWithFrame:CGRectMake(220,100, 100, 100)];
    [textfield setBackgroundColor:[UIColor orangeColor]];
    [self.view addSubview:textfield];
    
     UITextField *textfieldd = [[UITextField alloc] initWithFrame:CGRectMake(220,400, 100, 100)];
    [textfieldd setBackgroundColor:[UIColor orangeColor]];
    [self.view addSubview:textfieldd];
    
    [[ZZProgressHUD shareZZProgressHUD] setShowMinSizeWithoutLoading:CGSizeMake(80, 35)];
    [[ZZProgressHUD shareZZProgressHUD] setTextColor:[UIColor whiteColor]];
    [[ZZProgressHUD shareZZProgressHUD].showView setImageLocation:ZZButtonImageLocation_Top];
    [[ZZProgressHUD shareZZProgressHUD] setIsAutomaticClose:YES];
    [[ZZProgressHUD shareZZProgressHUD] setIsLineUpShow:NO];
    [[ZZProgressHUD shareZZProgressHUD] setLineUpInterval:1.5];
    [[ZZProgressHUD shareZZProgressHUD] setShowViewChangedBlock:^(ShowViewState state){
        NSLog(@"setShowViewChangedBlock %lu",(unsigned long)state);
    }];
    [[ZZProgressHUD shareZZProgressHUD] setShowLastBlock:^(ShowViewState state){
        NSLog(@"setShowLastBlock %lu",(unsigned long)state);
    }];
    [[ZZProgressHUD shareZZProgressHUD] setDismissBlock:^{
        NSLog(@"setDismissBlock");
    }];
}
static int dd = 0;
-(void)dddd{
    dd ++;
    switch (dd) {
        case 1:[ZZProgressHUD loading];break;
        case 2:[ZZProgressHUD loadingWithText:@"加载中啊啊啊啊啊啊"];break;
        case 3:[ZZProgressHUD showText:@"提示无图"];break;
        case 4:[ZZProgressHUD showInfoWithText:@"提示info"];break;
        case 5:[ZZProgressHUD showErrorWithText:@"提示error"];break;
        case 6:[ZZProgressHUD showSuccessWithText:@"提示success"];break;
        case 7:[ZZProgressHUD dismiss];break;
            
        default:
            break;
    }
    if (dd >= 7) {
        dd = 0;
    }
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [textfield resignFirstResponder];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
